<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Inici extends CI_Controller {
    
    public function index()
    {
        $data['pageTitle']="Pàgina inicial";
        $usuaris = $this->barrera_model->get_usuaris();
        
        $this->load->view('includes/header',$data);
        $this->load->view('includes/navBarHeader');
        $this->load->view('includes/navBarInicial');
        $this->load->view('includes/navBarFooter');
        $this->load->view('inicial_view',array(
            'usuaris' => $usuaris
        ));
        $this->load->view('includes/footer');
    }
    
    public function esborrar()
    {
        $this->barrera_model->del_usuari($this->uri->segment(3));
        $this->index();
        redirect("/inici");
    }
    
    public function afegir()
    {
        $this->barrera_model->add_usuari("Mario","8072",NULL);
        $this->index();
        redirect("/inici");
    }
    
}
?>
